package day240125;

import java.util.Scanner;

public class SwitchDemo {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入要查询的年份：");
        int n = scanner.nextInt();
        System.out.println("请输入要查询的月份：");
        int m = scanner.nextInt();
        int day = 0;
        switch(m){
            case 1,3,5,7,8,10,12:
                day = 31;
                break;
            case 4, 6, 9, 11:
                day = 30;
                break;
            case 2:
                if(n%4==0&&n%100!=0||n%400==0){
                    day = 29;
                }
                else{
                    day = 28;
                }
                break;
            default:
                System.out.println("月份输入有误");
                break;
        }
        if(m>0&&m<13)
            System.out.println(n + "年" + m + "月有" + day + "天");
    }
}
